home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / assembler-tools / apathysource / loader / introsupport.s < prev    next >
Encoding:
Text File  |  1980-02-04  |  19.4 KB  |  747 lines

  1. **************************************************
  2. * Support routines for demo - AGA fades,         *
  3. * interupts, linedraw, handy tables, handy       *
  4. * routines etc. USE WITH LOADER.O!               *
  5. * ---------------------------------------------- *
  6. *                                                *
  7. **************************************************
  8.  
  9.            Machine   68020
  10. ;;; "Includes"
  11.            Incdir    "!Includes:"
  12.            Include   "StdLibInc.i"
  13.            Include   "StdHardInc.i"
  14.            Include   "Loader.i"
  15.  
  16.            xref      OldInt
  17.            xref      OldDMA
  18.            xref      OldLev3
  19.            xref      SyncBit
  20.  
  21.            Incdir    "!Includes:OS3.0/"
  22.            Include   "exec/memory.i"
  23.            Include   "exec/exec.i"
  24.            Include   "dos/dos.i"
  25.            Include   "dos/dosextens.i"
  26. ;;;
  27. ;;; "Exported functions & datas"
  28.            xdef      _SetPtrs
  29.            xdef      _Sync
  30.            xdef      _InstallCopper
  31.  
  32.            xdef      _AllocPublic
  33.            xdef      _AllocChip
  34.            xdef      _FreeMem
  35.            xdef      _FreeAll
  36.            xdef      _FreeMany
  37.  
  38.            xdef      _AddVBLInt
  39.            xdef      _RemVBLInt
  40.  
  41.            xdef      _SetColByte
  42.            xdef      _InitFade
  43.            xdef      _DoFade
  44.  
  45.            xdef      P61_WaitCRow2
  46.            xdef      P61_WaitCRow
  47.            xdef      P61_WaitPos
  48.  
  49.            xdef      _Sin1024
  50.            xdef      _InitSinus
  51.            xdef      _InitSinus2
  52. ;;;
  53.  
  54.            Section   code,CODE
  55.  
  56. ;;; "_SetPtrs"
  57. *************************************************************
  58. * Sätter pekare i copperlistor.                             *
  59. * IN:    d0 - Antal bytes mellan varje bitplan (ex. 10240). *
  60. *        d1 - Adress till skärm, sprites etc.               *
  61. *        d2 - Hur många pekare som ska sättas (d2=ANTAL-1). *
  62. *        a0 - Adress till första pekaren.                   *                                  *
  63. * UT:    INGET                                              *
  64. *                                                           *
  65. * Förstör inga register.                                    *
  66. *************************************************************
  67. _SetPtrs:          Movem.l   d1-d2/a0,-(a7)
  68. .SetPtrs           Move.w    d1,6(a0)
  69.            Swap      d1
  70.            Move.w    d1,2(a0)
  71.            Swap      d1
  72.            Add.l     d0,d1
  73.            Addq.l    #8,a0
  74.            Dbra      d2,.SetPtrs
  75.            Movem.l   (a7)+,d1-d2/a0
  76.            Rts
  77. ;;;
  78. ;;; "_Sync"
  79. _Sync:             Movem.l   d0,-(a7)
  80.            Move.w    #0,SyncBit
  81. .Sync              Move.w    SyncBit,d0
  82.            Beq       .Sync
  83.            ;Move.w    #0,SyncBit
  84.            Movem.l   (a7)+,d0
  85.            Rts
  86. ;;;
  87. ;;; "_InstallCopper"
  88. _InstallCopper:    Movem.l   a5,-(a7)
  89.            Lea       Custom,a5
  90.            Move.l    a0,cop1lc(a5)
  91.            Move.w    d0,copjmp1(a5)
  92.            Move.w    #DMAF_SETCLR!DMAF_RASTER!DMAF_COPPER,dmacon(a5)
  93.            Movem.l   (a7)+,a5
  94.            Rts
  95. ;;;
  96.  
  97. ;;; "_AllocPublic"
  98. *********************************************************
  99. * Allokerar PUBLIC minne.                               *
  100. * IN: d0 - Storleken på minnet du vill allokera.        *
  101. *     d1 - ID (1 och uppåt)                             *
  102. * UT: d0 - Adressen till minnet, eller NOLL om det inte *
  103. *          finns något ledigt.                          *
  104. *                                                       *
  105. * Förstör inga register.                                *
  106. *********************************************************
  107. _AllocPublic:      Movem.l   d1-d7/a0-a6,-(a7)
  108.  
  109.            Lea       MemHeader,a0
  110.            Move.l    #128-1,d3
  111.            Moveq     #0,d2
  112. .checklop          Tst.l     (a0)
  113.            Bne       .next
  114.            Move.l    a0,d2
  115.            Bra       .done
  116. .next              Add.l     #12,a0
  117.            Dbra      d3,.checklop
  118.  
  119. .done              Tst.l     d2
  120.            Beq       .nomem
  121.            Move.l    d2,a5
  122.            Move.l    d0,d7
  123.            Move.l    d1,d6
  124.  
  125.            Move.l    #MEMF_CLEAR,d1
  126.            Move.l    _ExecBase,a6
  127.            Jsr       _LVOAllocMem(a6)
  128.            Tst.l     d0
  129.            Beq       .nomem
  130.  
  131.            Move.l    d0,(a5)+
  132.            Move.l    d6,(a5)+
  133.            Move.l    d7,(a5)+
  134.  
  135.            Movem.l   (a7)+,d1-d7/a0-a6
  136.            Rts
  137.  
  138. .nomem             Moveq     #0,d0
  139.            Movem.l   (a7)+,d1-d7/a0-a6
  140.            Rts
  141. ;;;
  142. ;;; "_AllocChip"
  143. *********************************************************
  144. * Allokerar CHIP minne.                                 *
  145. * IN: d0 - Storleken på minnet du vill allokera.        *
  146. *     d1 - ID (1 och uppåt)                             *
  147. * UT: d0 - Adressen till minnet, eller NOLL om det inte *
  148. *          finns något ledigt.                          *
  149. *                                                       *
  150. * Förstör inga register.                                *
  151. *********************************************************
  152. _AllocChip:        Movem.l   d1-d7/a0-a6,-(a7)
  153.  
  154.            Lea       MemHeader,a0
  155.            Move.l    #128-1,d3
  156.            Moveq     #0,d2
  157. .checklop          Tst.l     (a0)
  158.            Bne       .next
  159.            Move.l    a0,d2
  160.            Bra       .done
  161. .next              Add.l     #12,a0
  162.            Dbra      d3,.checklop
  163.  
  164. .done              Tst.l     d2
  165.            Beq       .nomem
  166.            Move.l    d2,a5
  167.            Move.l    d0,d7
  168.            Move.l    d1,d6
  169.  
  170.            Move.l    #MEMF_CLEAR!MEMF_CHIP,d1
  171.            Move.l    _ExecBase,a6
  172.            Jsr       _LVOAllocMem(a6)
  173.            Tst.l     d0
  174.            Beq       .nomem
  175.  
  176.            Move.l    d0,(a5)+
  177.            Move.l    d6,(a5)+
  178.            Move.l    d7,(a5)+
  179.  
  180.            Movem.l   (a7)+,d1-d7/a0-a6
  181.            Rts
  182.  
  183. .nomem             Moveq     #0,d0
  184.            Movem.l   (a7)+,d1-d7/a0-a6
  185.            Rts
  186. ;;;
  187. ;;; "_FreeMem"
  188. *********************************************************
  189. * Frigör minne.                                         *
  190. * IN: d0 - Adressen till minnet du vill frigöra.        *
  191. * UT: VOID                                              *
  192. *                                                       *
  193. * Förstör inga register.                                *
  194. *********************************************************
  195. _FreeMem:          Movem.l   d0-d3/a0-a2,-(a7)
  196.            Lea       MemHeader,a0
  197.            Move.l    #128-1,d1
  198. .checklop          Cmp.l     (a0),d0
  199.            Beq       .found
  200.            Add.l     #12,a0
  201.            Dbra      d1,.checklop
  202.            Movem.l   (a7)+,d0-d3/a0-a2
  203.            Rts
  204.  
  205. .found             Move.l    (a0),a1             ;Address
  206.            Move.l    8(a0),d0            ;Size
  207.  
  208.            Clr.l     (a0)
  209.            Clr.l     4(a0)
  210.            Clr.l     8(a0)
  211.  
  212.            Move.l    _ExecBase,a6
  213.            Jsr       _LVOFreeMem(a6)
  214.            Movem.l   (a7)+,d0-d3/a0-a2
  215.            Rts
  216. ;;;
  217. ;;; "_FreeAll"
  218. *********************************************************
  219. * Frigör allt minne.                                    *
  220. * IN: VOID                                              *
  221. * UT: VOID                                              *
  222. *                                                       *
  223. * Förstör inga register.                                *
  224. *********************************************************
  225. _FreeAll:          Movem.l   d0-d3/a0-a2,-(a7)
  226.            Lea       MemHeader,a0
  227.            Move.l    #128-1,d1
  228.  
  229. .checklop          Tst.l     (a0)
  230.            Bne       .found
  231. .next              Add.l     #12,a0
  232.            Dbra      d1,.checklop
  233.            Movem.l   (a7)+,d0-d3/a0-a2
  234.            Rts
  235.  
  236. .found             Movem.l   d0-d1/a0,-(a7)
  237.            Move.l    (a0),a1             ;Address
  238.            Move.l    8(a0),d0            ;Size
  239.            Clr.l     (a0)
  240.            Clr.l     4(a0)
  241.            Clr.l     8(a0)
  242.  
  243.            Move.l    _ExecBase,a6
  244.            Jsr       _LVOFreeMem(a6)
  245.            Movem.l   (a7)+,d0-d1/a0
  246.            Bra       .next
  247. ;;;
  248. ;;; "_FreeMany"
  249. *********************************************************
  250. * Frigör allt minne med speciellt ID.                   *
  251. * IN: d0 - ID                                           *
  252. * UT: VOID                                              *
  253. *                                                       *
  254. * Förstör inga register.                                *
  255. *********************************************************
  256. _FreeMany:         Movem.l   d0-d3/a0-a2,-(a7)
  257.            Lea       MemHeader,a0
  258.            Move.l    #128-1,d1
  259.  
  260. .checklop          Cmp.l     4(a0),d0
  261.            Beq       .found
  262. .next              Add.l     #12,a0
  263.            Dbra      d1,.checklop
  264.            Movem.l   (a7)+,d0-d3/a0-a2
  265.            Rts
  266.  
  267. .found             Movem.l   d0-d1/a0,-(a7)
  268.            Move.l    (a0),a1             ;Address
  269.            Move.l    8(a0),d0            ;Size
  270.            Clr.l     (a0)
  271.            Clr.l     4(a0)
  272.            Clr.l     8(a0)
  273.  
  274.            Move.l    _ExecBase,a6
  275.            Jsr       _LVOFreeMem(a6)
  276.            Movem.l   (a7)+,d0-d1/a0
  277.            Bra       .next
  278. ;;;
  279.  
  280. ;;; "_AddVBLInt"
  281. **************************************************************
  282. * Lägger till en VBL-interrupt till kedjan.                  *
  283. * IN: a0 - addressen till interruptrutinen                   *
  284. * UT: d0 - Resultat - 0=ingen interruptplats ledig,          *
  285. *                     1-8=interruptplatsen interrupten blev  *
  286. *                     installerad i.                         *
  287. *                                                            *
  288. **************************************************************
  289. _AddVBLInt:        Movem.l   d1-d7/a0-a6,-(a7)
  290.  
  291.            Move.l    _VBR,a1
  292.            Move.l    #Lev3Int,$6c(a1)
  293.            Move.l    #$8020,$dff09a
  294.  
  295.            Lea       VBLChain,a2
  296.            Move.l    #8-1,d3
  297.            Moveq     #0,d2
  298.            Moveq     #1,d4
  299. .checklop          Tst.l     (a2)
  300.            Bne       .next
  301.            Move.l    a2,d2
  302.            Bra       .done
  303. .next              Addq.l    #4,a2
  304.            Addq.l    #1,d4
  305.            Dbra      d3,.checklop
  306.  
  307. .done              Tst.l     d2
  308.            Beq       .noavailable
  309.            Move.l    d2,a2
  310.  
  311.            Move.l    a0,(a2)
  312.            Move.l    d4,d0
  313.            Movem.l   (a7)+,d1-d7/a0-a6
  314.            Rts
  315.  
  316. .noavailable       Movem.l   (a7)+,d1-d7/a0-a6
  317.            Moveq     #0,d0
  318.            Rts
  319. ;;;
  320. ;;; "_RemVBLInt"
  321. ******************************************************
  322. * Tar bort en interrupt från kedjan.                 *
  323. * IN: d0 - nummret på interruptplatsen (1-8).        *
  324. * UT: VOID                                           *
  325. *                                                    *
  326. ******************************************************
  327. _RemVBLInt:        Movem.l   d0/a0,-(a7)
  328.  
  329.            Lea       VBLChain,a0
  330.            Subq.l    #1,d0
  331.            Clr.l     (a0,d0.l*4)
  332.  
  333.            Bsr       _Sync
  334.            Bsr       _Sync
  335.  
  336.            Movem.l   (a7)+,d0/a0
  337.            Rts
  338. ;;;
  339. ;;; "Lev3 Interrupt Handler"
  340. Lev3Int:           Movem.l   d0-d7/a0-a6,-(a7)
  341.            Btst      #5,$dff01f
  342.            Beq       .novblreq
  343.  
  344.            Move.w    #1,SyncBit
  345.  
  346. .int1              Lea       VBLChain,a0
  347.            Tst.l     (a0)
  348.            Beq       .int2
  349.            Move.l    (a0),a1
  350.            Jsr       (a1)
  351.  
  352. .int2              Lea       VBLChain,a0
  353.            Tst.l     4(a0)
  354.            Beq       .int3
  355.            Move.l    4(a0),a1
  356.            Jsr       (a1)
  357.  
  358. .int3              Lea       VBLChain,a0
  359.            Tst.l     8(a0)
  360.            Beq       .int4
  361.            Move.l    8(a0),a1
  362.            Jsr       (a1)
  363.  
  364. .int4              Lea       VBLChain,a0
  365.            Tst.l     12(a0)
  366.            Beq       .int5
  367.            Move.l    12(a0),a1
  368.            Jsr       (a1)
  369.  
  370. .int5              Lea       VBLChain,a0
  371.            Tst.l     16(a0)
  372.            Beq       .int6
  373.            Move.l    16(a0),a1
  374.            Jsr       (a1)
  375.  
  376. .int6              Lea       VBLChain,a0
  377.            Tst.l     20(a0)
  378.            Beq       .int7
  379.            Move.l    20(a0),a1
  380.            Jsr       (a1)
  381.  
  382. .int7              Lea       VBLChain,a0
  383.            Tst.l     24(a0)
  384.            Beq       .int8
  385.            Move.l    24(a0),a1
  386.            Jsr       (a1)
  387.  
  388. .int8              Lea       VBLChain,a0
  389.            Tst.l     28(a0)
  390.            Beq       .novblreq
  391.            Move.l    28(a0),a1
  392.            Jsr       (a1)
  393.  
  394. .novblreq          Move.w    #%1110000,$dff09c
  395.            Movem.l   (a7)+,d0-d7/a0-a6
  396.            Nop
  397.            Rte
  398. ;;;
  399.  
  400. ;;; "_SetColByte"
  401. *****************************************
  402. * Ställer in färgen direkt i hårdvaran  *
  403. * IN:   d0 - Färg(0-255)                *
  404. *       d1 - R värde                    *
  405. *       d2 - G värde                    *
  406. *       d3 - B värde                    *
  407. *                                       *
  408. * UT:   VOID                            *
  409. *                                       *
  410. * Förstör inga register.                *
  411. *****************************************
  412. _SetColByte:       Movem.l   d0-d7/a0-a1,-(a7)
  413.            Lea       Custom,a5
  414.            Move.w    d0,d4
  415.            And.w     #$00e0,d4
  416.            Lsl.w     #8,d4
  417.            Move.w    d4,a0               ;Calculate Colorbank
  418.            Or.w      #$0200,d4
  419.            Move.w    d4,a1
  420.  
  421.            ;Get ECS part of RGB value
  422.  
  423.            Move.b    d1,d5
  424.            Lsr.b     #4,d5               ;Red
  425.  
  426.            Move.b    d2,d4
  427.            Lsr.b     #4,d4
  428.            And.b     #$f,d4              ;Green
  429.            Lsl.w     #4,d5
  430.            Or.b      d4,d5
  431.     
  432.            Move.b    d3,d4
  433.            Lsr.b     #4,d4
  434.            And.b     #$f,d4              ;Blue
  435.            Lsl.w     #4,d5
  436.            Or.b      d4,d5
  437.  
  438.            ;Get AGA part of RGB value
  439.  
  440.            Move.b    d1,d6               ;Red
  441.  
  442.            Move.b    d2,d4
  443.            And.b     #$f,d4              ;Green
  444.            Lsl.w     #4,d6
  445.            Or.b      d4,d6
  446.     
  447.            Move.b    d3,d4
  448.            And.b     #$f,d4              ;Blue
  449.            Lsl.w     #4,d6
  450.            Or.b      d4,d6
  451.  
  452.            And.l     #31,d0
  453.            Lsl.l     #1,d0               ;Calculate Color Register
  454.            Add.l     #$180,d0
  455.  
  456.            Move.w    a0,bplcon3(a5)
  457.            And.w     #$fff,d5
  458.            Move.w    d5,(a5,d0)          ;Set color
  459.            Move.w    a1,bplcon3(a5)
  460.            And.w     #$fff,d6
  461.            Move.w    d6,(a5,d0)
  462.  
  463.            Movem.l   (a7)+,d0-d7/a0-a1
  464.            Rts
  465. ;;;
  466. ;_SetCol16:
  467. ;_SetCol32:
  468. ;_SetColSplit:
  469.  
  470. ;_PolCol16:
  471. ;_PolCol32:
  472.  
  473. ;_MixCol16:
  474. ;_MixCol32:
  475.  
  476. ;_Col16To32:
  477. ;_Col32To16:
  478.  
  479. ;;; "_InitFade"
  480. _InitFade
  481. *************************************************
  482. * Förbereder strukturen för en skalning mellan  *
  483. * färger.                                       *
  484. *                                               *
  485. * IN:   d0 - Antal färger(Byt inte!)            *
  486. *       d1 - Längd på skalning (1-n)            *
  487. *       d2 - Första färg                        *
  488. *       d3 - Mask till BPLCON3                  *
  489. *       a0 - pekare till startfärg-värden.      *
  490. *       a1 - pekare till slutfärg-värden.       *
  491. *       a2 - pekare till 8192 bytes struktur.   *
  492. *                                               *
  493. * UT:                                           *
  494. *                                               *
  495. * Förstör bara input-register.                  *
  496. *************************************************
  497.  
  498.  
  499.     movem.l d0-d7/a0-a6,-(sp)
  500.  
  501.     tst.l   d1
  502.     bne     .NoDivBy0
  503.  
  504.     moveq.l #1,d1                           ;Just to secure the
  505.                         ;routine from a 
  506.                         ;stupid user.
  507. .NoDivBy0
  508.  
  509.     subq.l  #1,d0                           ;Another stupid
  510.     and.l   #255,d0                         ;user preventer.
  511.     addq.l  #1,d0
  512.  
  513.     move.l  a2,a3
  514.     add.l   #3088,a3
  515.     move.l  d1,(a2)+                        ;Store length of scaling
  516.     move.l  d2,(a2)+                        ;Store first colour
  517.     move.l  d0,(a2)+                        ;Store amount of colours
  518.     move.l  d3,(a2)+                        ;Store BPLCON3 mask
  519.  
  520.     sub.l   #1,d0
  521.  
  522. .AGAPrepareColor
  523.     addq.l  #1,a0
  524.     addq.l  #1,a1
  525.     move.l  #2,d4                           ;Loop 3 times (R,G,B)
  526.  
  527. .AGAPrepareGun
  528.     clr.l   d2
  529.     clr.l   d3
  530.     move.b  (a0)+,d2                        ;Get source colour component
  531.     lsl.l   #8,d2                           ;multiply by 256
  532.     move.b  (a1)+,d3                        ;Get dest colour component
  533.     lsl.l   #8,d3                           ;multiply by 256
  534.     sub.l   d2,d3                           ;Get differance
  535.     divs.l  d1,d3                           ;divide the diff. with the length
  536.     move.l  d3,(a2)+                        ;Store component-adder
  537.     move.l  d2,(a3)+                        ;Store source colour
  538.  
  539.     dbra    d4,.AGAPrepareGun
  540.     dbra    d0,.AGAPrepareColor
  541.     movem.l (sp)+,d0-d7/a0-a6
  542.     rts
  543. ;;;
  544. ;;; "_DoFade"
  545. _DoFade
  546. *********************************************************
  547. * Skalar övergången mellan 1 eller mer färger.          *
  548. * Skalar max 256 färger.                                *
  549. * OBS! Du måste kalla _AGAInitFade                      *
  550. * först!                                                *
  551. *                                                       *
  552. * IN:   a0 - pekare till reserverad arbetslista         *
  553. *                                                       *
  554. * UT:   d0 - >0 om skalningen är klar                   *
  555. *                                                       *
  556. * Förstör bara input-register                           *
  557. *********************************************************
  558.  
  559.     movem.l d0-d7/a0-a6,-(sp)
  560.  
  561.     Lea.l   Custom,a5
  562.  
  563.     tst.l   (a0)                            ;Fade finished?
  564.     ble     .FadeFinished                   ;branch if d4<0
  565.  
  566.     move.l  a0,a1
  567.     add.l   #3088,a1
  568.     subq.l  #1,(a0)+                        ;decrease counter
  569.     move.l  (a0)+,d4                        ;First colour
  570.     move.l  (a0)+,d7                        ;Get amount of colours
  571.     move.l  (a0)+,d5                        ;Get BPLCON3 mask
  572.  
  573.     subq.l  #1,d7
  574. .AGAFadeColor
  575.  
  576.     move.l  (a0)+,d1                        ;Get R adder
  577.     add.l   d1,(a1)+                        ;Modify R component
  578.     move.l  (a0)+,d1                        ;Get G adder
  579.     add.l   d1,(a1)+                        ;Modify G component
  580.     move.l  (a0)+,d1                        ;Get B adder
  581.     add.l   d1,(a1)+                        ;Modify B component
  582.  
  583.     sub.l   #12,a1
  584.     move.l  d4,d0
  585.     move.l  (a1)+,d1
  586.     lsr.l   #8,d1
  587.     move.l  (a1)+,d2
  588.     lsr.l   #8,d2
  589.     move.l  (a1)+,d3
  590.     lsr.l   #8,d3
  591.  
  592.     movem.l d4-d5/d7,-(sp)                  ;Store essential regs
  593.  
  594.     and.w   #$00e0,d4
  595.     lsl.w   #8,d4
  596.     or.w    d5,d4
  597.     move.w  d4,a4                           ;Calculate Colorbank
  598.     or.w    #$0200,d4
  599.     move.w  d4,a6
  600.  
  601.     ;Get ECS part of RGB value
  602.  
  603.     move.b  d1,d5
  604.     lsr.b   #4,d5                           ;Red
  605.  
  606.     move.b  d2,d4
  607.     lsr.b   #4,d4
  608.     and.b   #$f,d4                          ;Green
  609.     lsl.w   #4,d5
  610.     or.b    d4,d5
  611.  
  612.     move.b  d3,d4
  613.     lsr.b   #4,d4
  614.     and.b   #$f,d4                          ;Blue
  615.     lsl.w   #4,d5
  616.     or.b    d4,d5
  617.  
  618.     ;Get AGA part of RGB value
  619.  
  620.     move.b  d1,d6                           ;Red
  621.  
  622.     move.b  d2,d4
  623.     and.b   #$f,d4                          ;Green
  624.     lsl.w   #4,d6
  625.     or.b    d4,d6
  626.  
  627.     move.b  d3,d4
  628.     and.b   #$f,d4                          ;Blue
  629.     lsl.w   #4,d6
  630.     or.b    d4,d6
  631.  
  632.     and.l   #31,d0
  633.     lsl.l   #1,d0                           ;Calculate Color Register
  634.     add.l   #$180,d0
  635.  
  636.     move.w  a4,bplcon3(a5)
  637.     move.w  d5,(a5,d0)                      ;Set color
  638.     move.w  a6,bplcon3(a5)
  639.     move.w  d6,(a5,d0)
  640.  
  641.     movem.l (sp)+,d4-d5/d7                  ;Restore regs
  642.  
  643.     addq.l  #1,d4                           ;increase colour pointer
  644.  
  645.     dbra    d7,.AGAFadeColor
  646.  
  647.     movem.l (sp)+,d0-d7/a0-a6
  648.     moveq.l #0,d0                           ;Return NOT_FINISHED signal
  649.     rts
  650.  
  651. .FadeFinished
  652.  
  653.     movem.l (sp)+,d0-d7/a0-a6
  654.     moveq.l #-128,d0                        ;Return FINISHED signal
  655.     rts
  656. ;;;
  657.  
  658.  
  659. ;;; "P61_WaitPos"
  660. **********************************
  661. * IN: d0 - pos                   *
  662. **********************************
  663. P61_WaitPos:       Movem.l   d1,-(a7)
  664. .lop
  665.            Btst      #2,$dff016
  666.            Beq       .break
  667.  
  668.            Move.w    P61_Pos,d1
  669.            Cmp.w     d0,d1
  670.            Blt       .lop
  671.            Movem.l   (a7)+,d1
  672.  
  673.            Moveq     #0,d0
  674.            Rts
  675.  
  676. .break             Moveq     #1,d0
  677.            Movem.l   (a7)+,d1
  678.            Rts
  679.  
  680. ;;;
  681. ;;; "P61_WaitCRow"
  682. **********************************
  683. * IN: d0.w - Row                 *
  684. **********************************
  685. P61_WaitCRow:      Movem.l   d1,-(a7)
  686. .lop
  687.            Btst      #2,$dff016
  688.            Beq       .break
  689.  
  690.            Move.w    P61_CRow,d1
  691.            Cmp.w     d0,d1
  692.            Blt       .lop
  693.            Movem.l   (a7)+,d1
  694.  
  695.            Moveq     #0,d0
  696.            Rts
  697.  
  698. .break             Moveq     #1,d0
  699.            Movem.l   (a7)+,d1
  700.            Rts
  701. ;;;
  702. ;;; "P61_WaitCRow2"
  703. **********************************
  704. * IN: d0 - Row                   *
  705. **********************************
  706. P61_WaitCRow2:     Movem.l   d1,-(a7)
  707. .lop
  708.            Btst      #2,$dff016
  709.            Beq       .break
  710.  
  711.            Move.w    P61_CRow,d1
  712.            Cmp.w     d0,d1
  713.            Bgt       .lop
  714.            Movem.l   (a7)+,d1
  715.  
  716.            Moveq     #0,d0
  717.            Rts
  718.  
  719. .break             Moveq     #1,d0
  720.            Movem.l   (a7)+,d1
  721.            Rts
  722. ;;;
  723.  
  724. ;;; "_InitSinus"
  725. _InitSinus:        Lea       _Sin1024,a0
  726.            Move.l    #512-1,d0
  727.  
  728. .lop               Move.w    (a0),d1
  729.            Neg.w     d1
  730.            Move.w    d1,512*2(a0)
  731.            Addq.l    #2,a0
  732.            Dbra      d0,.lop
  733.  
  734.            Rts
  735. ;;;
  736.  
  737.            Section   data,DATA
  738.  
  739. _Sin1024:          Include   "SinList512-256.i"
  740.            Ds.b      1024
  741.  
  742.            Section   bss,BSS
  743.  
  744. MemHeader:         Ds.l      128*3            ;Address.l,ID.l,Size.l
  745. VBLChain:          Ds.l      8
  746.  
  747.